<?php
$e_email = $_SESSION['quickregister']['step2']['error']['mail'];
$e_remail = $_SESSION['quickregister']['step2']['error']['rmail'];
$e_password = $_SESSION['quickregister']['step2']['error']['password'];
$e_terms = $_SESSION['quickregister']['step2']['error']['terms'];
$focus = $_SESSION['quickregister']['step2']['error']['focus'];

$mail = $_SESSION['quickregister']['step2']['bean_email'];
$rmail = $_SESSION['quickregister']['step2']['bean_retypedEmail'];
$password = $_SESSION['quickregister']['step2']['bean_password'];
$terms = $_SESSION['quickregister']['step2']['bean_termsOfServiceSelection'];
$marketing = $_SESSION['quickregister']['step2']['bean_marketing']; 

if($_SESSION['login']['error_captcha'] >= 4)
{
    $captcha = true;
}
?>
<h2>%main_step2%</h2>

      <div id="inner-container">
        <div class="inner-content bottom-border">
            <div class="field">
                <label for="email-address">%step2_mail%</label>
                <input type="text" id="email-address" name="bean.email" value="<?=$mail?>" <?=$e_email?>/>
            </div>
            <div class="help">%step2_msg1%</div>
            <div class="field">
                <label for="email-address2">%step2_retrymail%</label>
                <input type="text" id="email-address2" name="bean.retypedEmail" value="<?=$rmail?>" <?=$e_remail?>/>
            </div>
            <div class="help">%step2_msg2%</div>

            <div id="password-field" class="field">
                <label for="register-password">%step2_password%</label>
                <input type="password" name="bean.password" id="register-password" maxlength="32" value="<?=$password?>" <?=$e_password?>/>
            </div>
            <div class="help">%step2_msg3%</div>
        </div>

        <div class="inner-content top-margin">
            <div class="field-content checkbox <?=$e_terms?>">
              <label>
                <input type="checkbox" name="bean.termsOfServiceSelection" id="terms" value="true" class="checkbox-field" <?php if($terms) { ?>checked="checked"<?php } ?>/>
                %step2_terms%
              </label>
            </div>            

            <div class="field-content checkbox">
              <label>
                                <input type="checkbox" name="bean.marketing" id="marketing" value="true" class="checkbox-field" <?php if($marketing) { ?>checked="checked"<?php } ?>/>
                %step2_marketing%
              </label>
            </div>
            <?php if($captcha) { ?>
            <div id="register-fieldset-captcha" class="field field-captcha">
               <div id="captcha-container">
                  <label>%captcha_tecle%</label>
                  <noscript>
                        <iframe src="https://www.google.com/recaptcha/api/noscript?k=[captcha_key]" height="300" width="290" frameborder="0"></iframe><br/>
                   </noscript>
                   <input type="text" id="recaptcha_response_field" value="" autocomplete="off" name="captchaResponse" class="text-field"/>
                    <div id="recaptcha_image" class="register-label"></div>
                    <br clear="all"/><a href="#" id="captcha-reload" onclick="Utils.reloadRecaptcha(); return false;">%captcha_reload%</a>
                </div>
            </div>
            <?php } ?>
            
        </div>
      </div>
    </form>

    <div id="select">
        <div class="button">
            <a id="proceed-button" href="#" class="area">%main_next%</a>
            <span class="close"></span>
        </div>
        <a href="[sll]/quickregister/back" id="back-link">%main_back%</a>
   </div>
</div>

<script type="text/javascript">
    document.observe("dom:loaded", function() {
        Event.observe($("back-link"), "click", function() {
            Overlay.show(null,'%main_loading%');
        });
        Event.observe($("proceed-button"), "click", function() {
            Overlay.show(null,'%main_loading%');            
            $("quickregister-form").submit();
        });
            $("<?php if($focus) { echo $focus; } else { ?>email-address<?php } ?>").focus();
    });
</script>

<?php if($captcha) {  ?>
        <script type="text/javascript">
            document.observe("dom:loaded", function() {
                Utils.showRecaptcha("register-fieldset-captcha", "6LcoY9USAAAAABvB9nkzgifopYIVmYQ4iMSpSU0D");
                if ($("captcha-reload")) {
                    Event.observe($("captcha-reload"), "click", function(e) {Event.stop(e); Utils.reloadRecaptcha()});
                }           
            });
        </script>
<?php } ?>

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-448325-19']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>